Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add points on completing quest and achievement #128

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

ayushtom
Copy link
Contributor

@ayushtom ayushtom commented Nov 7, 2023

closes #100
closes #99

@ayushtom ayushtom added the 🔥 Ready for review This pull request needs a review label Nov 7, 2023
src/utils.rs Outdated
}

// get total experience for a specific quest id from quest collection
let quests_collection: Collection<QuestDocument> = self.db.collection("quests");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to minimize the amount of queries you do. For example you can use facets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/utils.rs Outdated
let mut result = true;

// get completed tasks for a specific quest id from completed_tasks collection
for &item in total_tasks.iter() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing you can do is an aggregation to get the amount of tasks associated to a quest and the amount completed by the user, and check if those are equal, if so it means the user completed the quest. If you can do it in the same query which completes the task, that would be perfect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Th0rgal Th0rgal added ❌ Change request Change requested from reviewer and removed 🔥 Ready for review This pull request needs a review labels Nov 9, 2023
@ayushtom ayushtom added 🔥 Ready for review This pull request needs a review and removed ❌ Change request Change requested from reviewer labels Nov 9, 2023
@ayushtom ayushtom requested a review from Th0rgal November 9, 2023 15:12
@Th0rgal Th0rgal merged commit 5eef5a2 into master Nov 9, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔥 Ready for review This pull request needs a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add experience when you complete an achievement Add experience when you complete a quest
2 participants